﻿function  addReportChar() {
	var datas=[];
	switch(displayType)
	{
		case 2://饼图
			for(var i=0;i<dataList.length;i++){
				if(i==0){
					datas.push({name:dataList[i][columnList[0].id],y:dataList[i][columnList[1].id],sliced: true,selected: true})
				}else{
					datas.push([dataList[i][columnList[0].id],dataList[i][columnList[1].id]])
				}

			}
			$('#reportViwe').highcharts({
				chart: {
					plotBackgroundColor: null,
					plotBorderWidth: null,
					plotShadow: false
				},
				title: {
					text: reportName
				},
				tooltip: {
					pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'
				},
				plotOptions: {
					pie: {
						allowPointSelect: true,
						cursor: 'pointer',
						dataLabels: {
							enabled: true,
							color: '#000000',
							connectorColor: '#000000',
							format: '<b>{point.name}</b>: {point.percentage:.2f} %'
						}
					}
				},
				series: [{
					type: 'pie',
					name: '综合占比',
					data: datas
				}]
			});
			break;
		case 1://柱状图
			var categories=[];
			var series=[];
			for(var i=0;i<columnList.length;i++){
				if(i==0){
					for(var j=0;j<dataList.length;j++){
						categories.push(dataList[j][columnList[i].id])
					}

				}else{
					var data = []
					for(var j=0;j<dataList.length;j++){
						data.push(dataList[j][columnList[i].id])
					}
					series.push({name:columnList[i].name,data:data});
				}

			}
			$('#reportViwe').highcharts({
				chart: {
					type: 'column'
				},
				title: {
					text: reportName
				},
				/*subtitle: {
				 text: 'subtitle'
				 },*/
				xAxis: {
					categories: categories,
					crosshair: true
				},
				yAxis: {
					min: 0,
					title: {
						text: reportName
					}
				},
				tooltip: {
					headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
					pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
					'<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
					footerFormat: '</table>',
					shared: true,
					useHTML: true
				},
				plotOptions: {
					column: {
						pointPadding: 0.2,
						borderWidth: 0
					}
				},
				series: series
			});
			break;
		case 3://层叠柱状图
			var categories=[];
			var series=[];
			for(var i=0;i<columnList.length;i++){
				if(i==0){
					for(var j=0;j<dataList.length;j++){
						categories.push(dataList[j][columnList[i].id])
					}

				}else{
					var data = []
					for(var j=0;j<dataList.length;j++){
						data.push(dataList[j][columnList[i].id])
					}
					series.push({name:columnList[i].name,data:data});
				}

			}
			$('#reportViwe').highcharts({
				chart: {
					type: 'column'
				},
				title: {
					text: reportName
				},
				xAxis: {
					categories: categories
				},
				yAxis: {
					min: 0,
					title: {
						text: reportName
					},
					stackLabels: {
						enabled: true,
						style: {
							fontWeight: 'bold',
							color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
						}
					}
				},
				legend: {
					align: 'right',
					x: -30,
					verticalAlign: 'top',
					y: 25,
					floating: true,
					backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
					borderColor: '#CCC',
					borderWidth: 1,
					shadow: false
				},
				tooltip: {
					formatter: function () {
						return '<b>' + this.x + '</b><br/>' +
							this.series.name + ': ' + this.y + '<br/>' +
							'总共: ' + this.point.stackTotal;
					}
				},
				plotOptions: {
					column: {
						stacking: 'normal',
						dataLabels: {
							enabled: true,
							color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
							style: {
								textShadow: '0 0 3px black'
							}
						}
					}
				},
				series: series
			});
			break;
		case 5://水平杠
			var categories=[];
			var series=[];
			for(var i=0;i<columnList.length;i++){
				if(i==0){
					for(var j=0;j<dataList.length;j++){
						categories.push(dataList[j][columnList[i].id])
					}

				}else{
					var data = []
					for(var j=0;j<dataList.length;j++){
						data.push(dataList[j][columnList[i].id])
					}
					series.push({name:columnList[i].name,data:data});
				}

			}
			$('#reportViwe').highcharts({
				chart: {
					type: 'bar'
				},
				title: {
					text: reportName
				},
				/*subtitle: {
				 text: 'Source: Wikipedia.org'
				 },*/
				xAxis: {
					categories: categories,
					title: {
						text: null
					}
				},
				yAxis: {
					min: 0,
					title: {
						text: reportName,
						align: 'high'
					},
					labels: {
						overflow: 'justify'
					}
				},
				tooltip: {
					valueSuffix: ''
				},
				plotOptions: {
					bar: {
						dataLabels: {
							enabled: true
						}
					}
				},
				legend: {
					layout: 'vertical',
					align: 'right',
					verticalAlign: 'top',
					x: -40,
					y: 100,
					floating: true,
					borderWidth: 1,
					backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
					shadow: true
				},
				credits: {
					enabled: false
				},
				series: series
			});
			break;
		case 6://层叠水平杠
			var categories=[];
			var series=[];
			for(var i=0;i<columnList.length;i++){
				if(i==0){
					for(var j=0;j<dataList.length;j++){
						categories.push(dataList[j][columnList[i].id])
					}

				}else{
					var data = []
					for(var j=0;j<dataList.length;j++){
						data.push(dataList[j][columnList[i].id])
					}
					series.push({name:columnList[i].name,data:data});
				}

			}
			$('#reportViwe').highcharts({
				chart: {
					type: 'bar'
				},
				title: {
					text: reportName
				},
				xAxis: {
					categories: categories
				},
				yAxis: {
					min: 0,
					title: {
						text: reportName
					}
				},
				legend: {
					reversed: true
				},
				plotOptions: {
					series: {
						stacking: 'normal'
					}
				},
				series: series
			});
			break;
		case 4://线图
			var categories=[];
			var series=[];
			for(var i=0;i<columnList.length;i++){
				if(i==0){
					for(var j=0;j<dataList.length;j++){
						categories.push(dataList[j][columnList[i].id])
					}

				}else{
					var data = []
					for(var j=0;j<dataList.length;j++){
						data.push(dataList[j][columnList[i].id])
					}
					series.push({name:columnList[i].name,data:data});
				}

			}
			$('#reportViwe').highcharts({
				title: {
					text: reportName,
					x: -20 //center
				},
				/*subtitle: {
				 text: reportName,
				 x: -20
				 },*/
				xAxis: {
					categories: categories
				},
				yAxis: {
					title: {
						text: reportName
					},
					plotLines: [{
						value: 0,
						width: 1,
						color: '#808080'
					}]
				},
				tooltip: {
					valueSuffix: ''
				},
				legend: {
					layout: 'vertical',
					align: 'right',
					verticalAlign: 'middle',
					borderWidth: 0
				},
				series: series
			});
			break;
		default:
			""
	}
}
var numberFilters = [{ text: '等于', value: '='},{ text: '大于', value: '>' },{ text: '大于等于', value: '>='}, { text: '小于', value: '<' },{ text: '小于等于', value: '<=' }];
var dateFilters = [{ text: '之前(yyyy-mm-dd)', value: '<' },{ text: '之后(yyyy-mm-dd)', value: '>'}, { text: '期间(yyyy-mm-dd yyyy-mm-dd)', value: '<>' }];
var grid;
var filters=[];
function  addReportGrid() {
	var gridDiv = '<div id="grid' + reportId + '" pager="#pager1" sizeList="[10,25,50,100]" pageSize="' + pageSize + '"  pagerButtons="#buttons" class="mini-datagrid" multiSelect="true" allowCellWrap="false" allowAlternating="true" url="/suite/plugins/servlet/queryReportData?reportId=' + reportId + '" style="height:100%;"  idField="id" showFilterRow="true"  allowResize="false" ><div property="columns">';
	if (dataList == null) {
		gridDiv += '<div field="null"  headerAlign="center" allowSort="true">没有数据</div>'
	} else {
		gridDiv += '<div type="indexcolumn" width="40" ></div>'
	}
	for (var i = 0; i < columnList.length; i++) {
		dataOptions = 'data-options={link:"dp' + columnList[i].localId + '",formatToken:"' + columnList[i].formatToken + '"}';
		switch (columnList[i].formatToken) {
			case "number":
				gridDiv += '<div field="' + columnList[i].id + '" width="100"  ' + dataOptions + ' headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter" class="mini-filteredit" filterData="numberFilters" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" />' +
					'</div>'
				break;
			case "decimal_rounded_to_two_places":
				gridDiv += '<div field="' + columnList[i].id + '" width="100"  ' + dataOptions + ' headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter" class="mini-filteredit" filterData="numberFilters" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" />' +
					'</div>'
				break;
			case "string":
				gridDiv += '<div field="' + columnList[i].id + '" width="250" ' + dataOptions + '  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter"  class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" />' +
					'</div>'
				break;
			case "pmodels":
				gridDiv += '<div field="' + columnList[i].id + '" width="250" ' + dataOptions + '  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" name="pmodelsFilter" property="filter"  class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" />' +
					'</div>'
				break;
			case "users":
				gridDiv += '<div field="' + columnList[i].id + '" width="150" ' + dataOptions + ' headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" name="usersFilter" property="filter"  class="mini-autocomplete" emptyText="请选择用户" searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=1" valueFromSelect="true"  valueField="id" textField="name"  style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "userphoto":
				gridDiv += '<div field="' + columnList[i].id + '" width="140" ' + dataOptions + ' headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter"  class="mini-autocomplete" emptyText="请选择用户" searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=1" valueFromSelect="true"  valueField="id" textField="name"  style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "groups":
				gridDiv += '<div field="' + columnList[i].id + '" width="150" ' + dataOptions + ' headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter"  emptyText="请选择组" class="mini-autocomplete"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=2" valueFromSelect="true"  valueField="id" textField="name"  style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "date":
				gridDiv += '<div field="' + columnList[i].id + '" ' + dataOptions + ' width="195"  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter" class="mini-filteredit" filterData="dateFilters" emptyText="请填写日期" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "datetime":
				gridDiv += '<div field="' + columnList[i].id + '" ' + dataOptions + ' width="195"  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" property="filter" class="mini-filteredit" filterData="dateFilters" emptyText="请填写日期" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
		/**    case 20:
		 gridDiv+='<div field="'+columnList[i].id+'" width="160" '+dataOptions+'  headerAlign="center" allowSort="true">'+columnList[i].name+
		 '<input id="'+columnList[i].id+'Filter" property="filter"  url="/suite/plugins/servlet/execute/getcommunitytree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="选择社区"  expandOnNodeClick="true" expandOnNodeClick="true" onbeforenodeselect="beforenodeselect"  allowInput="true" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />'+
		 '</div>'
		 break;
		 case 19:
		 gridDiv+='<div field="'+columnList[i].id+'" width="160" '+dataOptions+'  headerAlign="center" allowSort="true">'+columnList[i].name+
		 '<input id="'+columnList[i].id+'Filter" property="filter"  url="/suite/plugins/servlet/execute/getknowledgecentertree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="选择知识中心" valueFromSelect="true"  expandOnNodeClick="true"  onbeforenodeselect="beforenodeselect" allowInput="true" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />'+
		 '</div>'
		 break;
		 case 12:
		 gridDiv+='<div field="'+columnList[i].id+'" width="200" '+dataOptions+'  headerAlign="center" allowSort="true">'+columnList[i].name+
		 '<input id="'+columnList[i].id+'Filter" property="filter"  url="/suite/plugins/servlet/execute/getfoldertree?issub=false"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="选择文件夹" valueFromSelect="true"  expandOnNodeClick="true"   onbeforenodeselect="beforefolderselect" onbeforenodecheck="beforefolderselect" allowInput="true" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />'+
		 '</div>'
		 break;
		 case 13:
		 gridDiv+='<div field="'+columnList[i].id+'" width="230" '+dataOptions+'  headerAlign="center" allowSort="true">'+columnList[i].name+
		 '<input id="'+columnList[i].id+'Filter" property="filter"  url="/suite/plugins/servlet/execute/getfoldertree?issub=true"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="选择文件" valueFromSelect="true"  expandOnNodeClick="true"  onbeforenodeselect="beforedocumentselect" onbeforenodecheck="beforedocumentselect" allowInput="true" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />'+
		 '</div>'
		 break;**/
			case "priority":
				gridDiv += '<div field="' + columnList[i].id + '" width="100" ' + dataOptions + '  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" name="priorityFilter" property="filter"  class="mini-combobox" data=[{text:"低",value:0},{text:"普通",value:1},{text:"高",value:2}] textField="text" valueField="value" emptyText="优先级"  allowInput="false" showNullItem="true" nullItemText="" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "processstatus":
				gridDiv += '<div field="' + columnList[i].id + '" width="100" ' + dataOptions + '  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" name="processstatusFilter" property="filter"  class="mini-combobox" data=[{text:"进行中",value:0},{text:"已完成",value:1},{text:"暂停",value:2},{text:"已取消",value:3},{text:"因问题暂停",value:4},{text:"异常",value:5}] textField="text" valueField="value" emptyText="状态"  allowInput="false" showNullItem="true" nullItemText="" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			case "taskstatus":
				gridDiv += '<div field="' + columnList[i].id + '" width="100" ' + dataOptions + '  headerAlign="center" allowSort="true">' + columnList[i].name +
					'<input id="' + columnList[i].id + 'Filter" name="taskstatusFilter" property="filter"  class="mini-combobox" data=[{text:"进行中",value:1},{text:"已完成",value:2}] textField="text" valueField="value" emptyText="状态"  allowInput="false" showNullItem="true" nullItemText="" style="width:100%;" onvaluechanged="onFilterChanged" showClose="true" oncloseclick="onCloseClick" />' +
					'</div>'
				break;
			default:
				""
				break;
		}
	}
	gridDiv += "</div></div>"
	gridDiv += "<div id='buttons'><a class='mini-button' href=javascript:formExcelexport('" + reportId + "')  >导出Excel</a></div>"
	$("#reportViwe").append(gridDiv);
	mini.parse();
	grid = mini.get("grid" + reportId);
	grid.set({numberFilters: numberFilters});
	grid.setData(dataList);
	grid.setTotalCount(total);
	var filters = [];
	if (columnList.length == 0) {
		grid.set({showFilterRow: false});
	}
	grid.on("drawcell", function (e) {
		var record = e.record;
		var column = e.column;
		var field = e.field;
		var value = e.value;
		var rowIndex = e.rowIndex;
		if(column.formatToken=="users"){
			if(value!=null&&value!=""){
				e.cellHtml="&nbsp;&nbsp;<img src='/suite/plugins/servlet/loadSource/3/"+value.split("#")[0]+".png' style='border-radius:2px;' width='30' />&nbsp;<a href='/suite/plugins/servlet/loadSource/CommunityPortal/PageAndJs/PageFiles/index.html#/app/userprofile/"+value.split("#")[0]+"' target='_blank' style='text-decoration:none;color: #428BCA;' >"+value.split("#")[1]+"</a>"
			}
		}else if(column.formatToken=="userphoto"){
			if(value!=null&&value!=""){
				e.cellHtml="&nbsp;&nbsp;<img src='/suite/plugins/servlet/loadSource/3/"+value.split("#")[0]+".png' style='border-radius:2px;' width='40' >&nbsp;"
			}
		}else if(column.formatToken=="groups"){
			if(value!=null&&value!=""){
				e.cellHtml=value.split("#")[1];
			}
		}else if(column.formatToken==20||column.formatToken==12||column.formatToken==19){
			if(value!=null&&value!=""){
				e.cellHtml=value.split("#")[1];
			}
		}else if(column.formatToken==13){
			if(value!=null&&value!=""){
				e.cellHtml="<a href='/suite/doc/"+value.split("#")[0]+"' target='_blank' style='text-decoration:none;color: #428BCA;' >"+value.split("#")[1]+"</a>";
			}
		}else if(record[column.link]!=null){
			if(value!=null&&value!=""){
				if(value.indexOf("#")>-1){
					value = value.split("#")[1];
				}
				e.cellHtml="<a href='/suite"+record[column.link]+"' target='_blank' style='text-decoration:none;color: #428BCA;' >"+value+"</a>"
			}
		}else if(column.formatToken=="string"&&typeof(value)=="string"&&value.indexOf(";")>-1){
			if(value!=null&&value!=""&&value!="; "){
				e.cellHtml=value.replaceAll(";","<br /><hr></hr>");
			}else{
				e.cellHtml="";
			}
		}else if(column.formatToken=="priority"){
			if(value==0){
				e.cellHtml="低";
			}else if(value==1){
				e.cellHtml="普通";
			}else if(value==2){
				e.cellHtml="高";
				e.rowStyle = "background:#FFF0F5;";
			}
		}else if(column.formatToken=="processstatus"){
			if(value==0){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-info' >进行中</span>";
			}else if(value==1){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-success' >已完成</span>";
			}else if(value==2){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-warning' >暂停</span>";
			}else if(value==3){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-dark' >已取消</span>";
			}else if(value==2){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-danger' >因问题的暂停</span>";
			}else if(value==2){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-danger' >异常</span>";
			}
		}else if(column.formatToken=="taskstatus"){
			if(value==0){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-warning' >待接收</span>";
			}else if(value==1){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-info' >进行中</span>";
			}else if(value==2){
				e.cellHtml="<span class='label m-l-sm ng-scope bg-success' >已完成</span>";
			}else{
				e.cellHtml="<span class='label m-l-sm ng-scope bg-danger' >异常</span>:"+value;
			}
		}

	});
}


function formExcelexport(id){
	$("#excelexportIframe"+id).remove();
	$("#excelexportForm"+id).remove();
	var iframe = $("body").append("<iframe id='excelexportIframe"+id+"' name='excelexportIframe"+id+"' style='display:none;'  ></iframe>");
	var form = $('<form  action="/suite/plugins/servlet/exportReportExcel" method="GET" name="excelexportForm' + id + '" id="excelexportForm' + id + '" target="excelexportIframe'+id+'" ></form>');
	$("<input type='hidden' name='filters' value='" + mini.encode(filters) + "' />").appendTo(form);
	$("<input type='hidden' name='reportId' value='" + id + "' />").appendTo(form);
	$(form).css('position', 'absolute');
	$(form).css('top', '-1200px');
	$(form).css('left', '-1200px');
	$(form).appendTo('body');
	$("#excelexportForm"+id).submit();
}

function onFilterChanged() {
	var dateRegExp = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/;
	filters=[];
	for(var i=0;i<columnList.length;i++){
		var filterObj = mini.get(columnList[i].id+"Filter");
		if(filterObj.getValue()!=""){
			var filter = {};
			filter["id"]=columnList[i].id;
			filter["localId"]=columnList[i].localId;
			filter["typeId"]=columnList[i].typeId;
			filter["formatToken"]=columnList[i].formatToken;

			if(columnList[i].formatToken=="number"||columnList[i].formatToken=="decimal_rounded_to_two_places"){
				if(filterObj.getFilterValue()==""){
					return;
				}else{
					filter["operation"]=filterObj.getFilterValue();
					filter["value"]=filterObj.getValue();
				}
				filters.push(filter);
			}if(columnList[i].formatToken=="datetime"||columnList[i].formatToken=="date"){
				if(filterObj.getFilterValue()==""){
					return;
				}else{
					if(filterObj.getFilterValue()=="<>"){
						var filter1 = {};
						filter1["id"]=columnList[i].id;
						filter1["localId"]=columnList[i].localId;
						filter1["formatToken"]=columnList[i].formatToken;
						filter1["operation"]=">";
						if(!dateRegExp.test(filterObj.getValue().split(" ")[0])){
							alert("日期填写不正确");
							return;
						}
						filter1["value"]=filterObj.getValue().split(" ")[0];
						filters.push(filter1);
						var filter2 = {};
						filter2["id"]=columnList[i].id;
						filter2["localId"]=columnList[i].localId;
						filter2["formatToken"]=columnList[i].formatToken;
						filter2["operation"]="<";
						if(!dateRegExp.test(filterObj.getValue().split(" ")[1])){
							alert("日期填写不正确");
							return;
						}
						filter2["value"]=filterObj.getValue().split(" ")[1];
						filters.push(filter2);

					}else{
						if(!dateRegExp.test(filterObj.getValue())){
							alert("日期填写不正确");
							return;
						}
						filter["operation"]=filterObj.getFilterValue();
						filter["value"]=filterObj.getValue();
						filters.push(filter);
					}
				}

			}else if(columnList[i].formatToken=="string"||columnList[i].formatToken=="pmodels"){
				filter["operation"]="like";
				filter["value"]="*"+filterObj.getValue()+"*";
				filters.push(filter);
			}else if(columnList[i].formatToken==20||columnList[i].formatToken==19||columnList[i].formatToken==12||columnList[i].formatToken==13||columnList[i].formatToken=="groups"||columnList[i].formatToken=="users"||columnList[i].formatToken=="userphoto"){
				filter["operation"]="=";
				filter["value"]=filterObj.getValue();
				filters.push(filter);
			}else if(columnList[i].formatToken=="taskstatus"){
				filter["operation"]="=";
				filter["value"]=filterObj.getValue();
				filters.push(filter);
			}else if(columnList[i].formatToken=="processstatus"){
				filter["operation"]="=";
				filter["value"]=filterObj.getValue();
				filters.push(filter);
			}else if(columnList[i].formatToken=="priority"){
				filter["operation"]="=";
				filter["value"]=filterObj.getValue();
				filters.push(filter);
				if(reportType==2){
					mini.getbyName("taskstatusFilter").setValue("1");
				}
			}

		}
	}
	grid.load({filters:mini.encode(filters)});
	//console.log(filters);
}
function beforenodeselect(e) {
	//禁止选中父节点
	if (e.isLeaf == false) e.cancel = true;
}
function beforefolderselect(e) {
	//禁止选中父节点
	if (e.node.type != 2) e.cancel = true;
}
function beforedocumentselect(e) {
	//禁止选中父节点
	if (e.node.type != 1) e.cancel = true;
}
function  beforecontentselect(e) {
	//禁止选中父节点
	if (e.node.type != 1&&e.node.type != 2) e.cancel = true;
}
function onCloseClick(e) {
	var obj = e.sender;
	obj.setText("");
	obj.setValue("");
	obj.doValueChanged();
}
